import request from '@/utils/request'
import type { TaskDTO } from '@/views/workbench/kitchen/types'

// 获取所有厨房任务
export function fetchKitchenTasks() {
    return request({
      url: '/kitchen/tasks',
      method: 'get'
    })
  }

// 更新菜品状态
export function updateDishStatus(params: {
    taskId: string
    dishId: string
    status: '待制作' | '制作中' | '已完成'
  }) {
    return request({
      url: '/kitchen/tasks/dish-status',
      method: 'put',
      data: params
    })
  }

// 完成整个任务
export function completeTask(taskId: string) {
    return request({
      url: `/kitchen/tasks/complete`,
      method: 'put',
      data: { taskId }
    })
  }

  // 创建厨房任务
export function createKitchenTask(orderId: string) {
    return request({
      url: `/order/createKitchenTask`,
      method: 'post',
      data: { orderId }
    })
  }